{% load navigation_tags wagtailcore_tags %}
{% get_site_root as site_root %}

{% if calling_page|has_protocol_parent and calling_page.content_type.model == 'standardpage' %}
  <div class="off-canvas position-left reveal-for-large bla" id="offCanvasLeft" data-off-canvas>
    {% protocol_menu calling_page=calling_page %}
  </div>
{% elif ancestor.has_children %}
  <div class="off-canvas position-left reveal-for-large" id="offCanvasLeft" data-off-canvas>
    <nav class="sidebar-nav">
      <h3>In this section</h3>
      <ul class="vertical menu">
        {% for menuitem in ancestor.children %}
          <li class="{% if menuitem.is_active %}is-active{% endif %}">
            <a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>

            {% if menuitem.is_active and menuitem.has_children %}
              <ul class="nested vertical menu is-active">
                {% for child in menuitem.children %}
                  <li>
                    <a href="{% pageurl child %}">{{ child.title }}</a>
                  </li>

                {% endfor %}
              </ul>
            {% endif %}
          </li>
        {% endfor %}
      </ul>
    </nav>
  </div>
{% endif %}
